package com.hizzyzzh.source.java.base.java.util;

import com.hizzyzzh.source.java.base.java.util.function.Consumer;

public interface Iterator<E> {

    boolean hasNext();

    E next();

    void remove();

    default void forEachRemaining(Consumer<? super E> action){
        Objects.requireNonNull(action);
        while (hasNext())
            action.accept(next());
    }
}
